begintownscript;

 begintownscript;	

 variables;
int i,j,k,r1,choice;
body;
beginstate INIT_STATE;
	set_name(6,"Bartender");
	set_name(7,"Corporal Korso");
	set_name(8,"Mayor Tallen");
	set_name(9,"Ereleno");
	set_name(10,"Kara");
	set_name(11,"Nuolo");
	set_name(12,"Seppo");
	set_name(13,"Jane");
	set_name(14,"Jorge");

	set_crime_tolerance(1);

	if (get_flag(110,3) == 5) {
		set_terrain(20,6,0);
		set_terrain(19,6,0);
		set_terrain(18,6,0);
		set_terrain(18,7,0);
		set_terrain(18,8,0);
		set_terrain(18,9,0);
		set_terrain(20,10,0);
		set_terrain(19,10,0);
		set_terrain(18,10,0);
// Tent 2
		set_terrain(27,11,0);
		set_terrain(29,11,0);
		set_terrain(28,11,0);
		set_terrain(29,10,0);
		set_terrain(29,8,0);
		set_terrain(29,9,0);
		set_terrain(27,7,0);
		set_terrain(29,7,0);
		set_terrain(28,7,0);
// Tent 3
		set_terrain(27,12,0);
		set_terrain(29,12,0);
		set_terrain(28,12,0);
		set_terrain(29,13,0);
		set_terrain(29,14,0);
		set_terrain(29,15,0);
		set_terrain(27,16,0);
		set_terrain(29,16,0);
		set_terrain(28,16,0);

		relocate_character(13,38,27);
		relocate_character(11,33,25);
		relocate_character(12,32,21);
		erase_char(6);
		activate_hidden_group(2);
		set_character_pose(26,14);
		set_character_pose(27,14);
		set_character_pose(28,14);
		set_character_pose(29,14);
		if (get_flag(0,10) == 0) {
			set_flag(0,10,1);
			activate_hidden_group(1);
			erase_char(8);
			set_name(25,"Mayor Tallen");
		}
}

	if (get_flag(100,8) >= 1) {
		activate_hidden_group(2);
		set_character_pose(26,14);
		set_character_pose(27,14);
		set_character_pose(28,14);
		set_character_pose(29,14);
		force_instant_terrain_redraw();
}

	if (get_flag(60,1) == 1) {
		activate_hidden_group(2);
		erase_char(7);
		activate_hidden_group(3);
		set_name(31,"Corporal Korso");
		set_name(30,"Sergeant Parks");
}

	 break;	

beginstate START_STATE;

	if (get_ran(1,0,100) < 8)
		text_bubble_on_char(14,"Listen to this!");
	if (get_ran(1,0,100) < 8)
		text_bubble_on_char(14,"Jarmo, I mean.");
	if (get_ran(1,0,100) < 8)
		text_bubble_on_char(15,"Good Lord!");
	if (get_ran(1,0,100) < 8)
		text_bubble_on_char(15,"Oh my!");
break;	

beginstate EXIT_STATE;
break;

beginstate 10;

	if (get_flag(0,1) == 0) {
		reset_dialog();
		add_dialog_str(0,"Having assured yourself that you have indeed woken up, you give your muscles a final stretching and head out from your room. The beds were truly uncomfortable, not that it mattered much when you fell onto them last night.",0);
		add_dialog_str(1,"A window in the hallway lets in a tiny ray of sunlight, which promptly vanishes. You move to the window and gaze at the town of Passton outside. The ground is still moist from the thunderstorm of yesterday.",0);
		add_dialog_str(2,"Clouds blanket the sky, but here and there a touch of blue winks at you from beneath the gray shroud. There is little to no movement on the streets. It seems that you have stumbled upon a common sleepy backwater.",0);
		add_dialog_str(3,"Still, you have a strange feeling about Passton. It is perhaps a bit too quiet. Something peculiar is going on here.",0);
		run_dialog(1);
		set_flag(0,1,1);
}

 break;

beginstate 11;

	if (get_flag(0,2) == 0) {
		reset_dialog();
		add_dialog_str(0,"You step into the empty common room of the inn. It is in reasonable shape, although the wooden floor does contain some traces of mud from yesterday, but the inn is completely deserted. No-one occupies the three various sized tables in the room.",0);
		add_dialog_str(1,"There is nobody by the counter either. In fact the only a tired-looking bartender is present, leaning on the counter. No, he is not tired, he is drunk. When he notices you he grabs the wine jug on the counter and takes a swig.",0);
		add_dialog_str(2,"Due to the unnatural quiet of the inn you can hear that the jug is almost empty. The bartender is not only drunk; he is drunk off his ass!",0);
		run_dialog(1); 
		set_flag(0,2,1);
}
 break;

beginstate 12;

	if (get_flag(0,3) == 0) {
		message_dialog("Ahead of you is the north gate of Passton. Two Empire soldiers are standing guard by the gate. Actually, _gate_ is not a very accurate description of the hole in the wall, for it does not have an actual gate.","A few archers stand on the town walls, their eyes not straying from the north. Three tents have been set up in the vicinity of the gate. They must be merchants' tents. Practically no-one is smiling.");
		set_flag(0,3,1);
}
 break;

 beginstate 13;

	if (get_flag(0,4) == 0) {
		reset_dialog();
		add_dialog_str(0,"As is the way in backwaters, only the town hall has been built with stone. Although sometimes one of the numerous religions of the Empire decides to construct its temple in stone, even in backwaters.",0);
		add_dialog_str(1,"Passton, however, does not appear to have a temple, and the town hall is not exactly pristine either. You step onto the cracking marble of the town hall floor and notice a receptionist by a desk in the hall.",0);
		add_dialog_str(2,"She notices you as well, but judging by her expression, she is not particularly thrilled to see you.",0);
		run_dialog(1);
		set_flag(0,4,1);
}
 break;

 beginstate 14;

	message_dialog("The trapdoor into the cellar is locked with a heavy padlock, the tricky kind that would take some time to unlock. Theoretically, you could try to open the door, but if you got caught you would soon be run out of town for certain.","It is best not to bother with it for now. There is probably nothing special in the cellars anyway.");
	block_entry(1);
 break;

 beginstate 15;
	if (get_flag(0,7) == 0) {
		message_dialog("The archives. Probably the most worthless place in any Empire village or town. Though it must have some merits in terms of administering and such.","But you are probably not interested in finding out how much wool the local sheep farmers produced last year.");
		set_flag(0,7,1);
}
 break;

 beginstate 16;
	if (get_flag(0,9) == 0) {
		message_dialog("You step inside the barracks of Passton. The wooden building looked to be in good shape from the outside. From the inside military discipline has kept the corners clean and the should be true for the beds.","There are nine bunks, but only the minority of them are made in the proper military fashion. Most of the beds have not been made at all. They have been slept in and left the way they were when whoever slept in them woke up.");
		set_flag(0,9,1);
}
 break;

 beginstate 17;
	if (char_ok(10) == TRUE) {
		message_dialog("The receptionist gives your fingers a good slap. _Hey! You have no business going through my desk! Get lost before I summon the guards!_","");
		block_entry(1);
}
 break;

 beginstate 18;
	if (get_flag(0,5) == 0) {
		reset_dialog();
		add_dialog_str(0,"One of the soldiers blocks your passage. _Hold on a minute there! Are you aware of what's outside? It's dangerous. Have you talked to mayor Tallen?_",0);
		add_dialog_choice(0,"I have not.");
		add_dialog_choice(1,"Yes, yes. I am well briefed.");
		choice = run_dialog(1);

		if (choice == 1) {
			message_dialog("_In that case, I cannot allow you to exit Passton. At least not through this here north gate. I'd suggest for you to either go and talk to Mayor Tallen who should be at the town hall or leave Quarhag Pass entirely._","The guard waves you away.");
			block_entry(1);
}
		if (choice == 2)
			message_dialog("_Oh, alright. I suppose it's okay for you to leave then. Just be careful out there._","The guard waves you through.");
}
 break;

 beginstate 19;
	if (get_flag(0,14) == 0) {
		message_dialog("_Excuse me, where do you think you're going?_ You turn to see who spoke. It was the woman by the desk. _You can't just barge in like that! That's the mayor's office. Don't you know that... Well, it's... You just can't go in like that!_","Apparently you should talk to this woman first.");
		block_entry(1);
}
 break;